<!-- 扩展 -->
{eyou:case value="img"}
<div class="form-group">
    <div class="input-group input-group-icon">
        <span class="input-group-addon"><i class="fa fa-shield"></i></span>
        <input type="text" class="  form-control" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="" style="display: none;"><!--{$vo.info|default=''}-->
        <input class=" form-control {$vo.fieldArr}_{$vo.name|default=''}_input" placeholder="{$vo.title}" style="height: 43px;" {eyou:eq name='is_mobile' value='1'} onClick="Get_mobile_{$vo.fieldArr}_{$vo.name|default=''}(1,'','{$vo.title}')" {eyou:else/} onClick="GetUploadify(1,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back','{:url('user/Uploadify/upload',['resource'=>'reg'])}')" {/eyou:eq}>
    </div>
</div>
<script type="text/javascript">

    // 手机端上传单张图
    function Get_mobile_{$vo.fieldArr}_{$vo.name|default=''}(num, url='', title)
    {
        var scriptUrl = '__ROOT_DIR__/public/plugins/layer_mobile/layer.js?v={$version}';
        // end
        $.getScript(scriptUrl, function(){

            if (num > 0) {
                if (!url) {
                    url = "{:url('user/Uploadify/upload',['resource'=>'reg'])}";
                }

                if (url.indexOf('?') > -1) {
                    url += '&';
                } else {
                    url += '?';
                }

                var content = $('#update_mobile_file').html();
                content = content.replace(/up_f/g, 'upfile');
                content = content.replace(/form1/g,'theForm{$vo.fieldArr}_{$vo.name|default=\'\'}');
                content = content.replace(/MobileHeadPic/g,"changeImgMobileUpload_{$vo.fieldArr}_{$vo.name|default=''}");

                layer_GetUploadify = layer.open({
                    type:1,
                    title:title,
                    anim:'up',
                    style:'position:fixed; bottom:0; left:0; width: 100%; padding:10px 0; border:none;max-width: 100%;',
                    content:content,
                });
            } else {
                layer.open({
                    content: '允许上传0张图片',
                    skin: 'footer',
                });
                return false;
            }
        });
    }

    function changeImgMobileUpload_{$vo.fieldArr}_{$vo.name|default=''}(){

        $.getScript('__ROOT_DIR__/public/plugins/layer_mobile/layer.js?v={$version}', function(){
            // 提示信息，2秒自动关闭
            function MsgOpen(msgs){
                layer.open({
                    content: msgs,
                    skin: 'msg',
                    time: 2,
                });
            }

            // 提示信息，估计在底部提示，点击空白处关闭
            function FooterOpen(msgs){
                layer.open({
                    content: msgs,
                    skin: 'footer',
                });
            }

            // 提示动画
            function LoaDing(){
                var loading = layer.open({
                    type:2,
                    content: '正在处理',
                });
                return loading;
            }

            UpdateImgMobileHeadPic_{$vo.fieldArr}_{$vo.name|default=''}();

            // 移动端更换头像
            function UpdateImgMobileHeadPic_{$vo.fieldArr}_{$vo.name|default=''}()
            {
                // 正在处理提示动画
                var loading = LoaDing();
                // 获取表单对象

                var data = new FormData($('#theForm{$vo.fieldArr}_{$vo.name|default=\'\'}')[0]);

                $.ajax({
                    url: "{eyou:url link='user/Uploadify/imageUp' vars='savepath=allimg&pictitle=head_pic&dir=images&resource=reg'/}",
                    type: 'post',
                    data: data,
                    dataType: 'json',
                    cache: false,
                    processData: false,
                    contentType: false,
                    success:function(res){
                        if (res.state == 'SUCCESS') {
                            layer.closeAll();
                            $.getScript('__ROOT_DIR__/public/plugins/layer-v3.1.0/layer.js?v={$version}', function(){});
                            {$vo.fieldArr}_{$vo.name|default=''}_call_back(res.url);

                        }else{
                            layer.close(loading);
                            MsgOpen(res.state);
                        }
                    },
                    error : function(e) {
                        layer.close(loading);
                        FooterOpen(e.responseText);
                    }
                });
            };
        })
    }

    function {$vo.fieldArr}_{$vo.name|default=''}_call_back(fileurl_tmp)
    {
        $("#{$vo.fieldArr}_{$vo.name|default=''}").val(fileurl_tmp);
        $(".{$vo.fieldArr}_{$vo.name|default=''}_input").val(fileurl_tmp);
    }
</script>
<!-- 单张图 end -->
{/eyou:case}